<?php	
	$db = new MySQL();   
	$table = "common";
	$id = $_GET['id'];	
	$mod = $_GET['mod'];
	
	$titlepage = (isset($_POST["titlepage"]))?$_POST["titlepage"]:"";
		$titlepage = str_replace("'", "\\'", $titlepage);
		$titlepage = str_replace("\\\'", "\\'", $titlepage);	
		
	$titlepage_vn = (isset($_POST["titlepage_vn"]))?$_POST["titlepage_vn"]:"";
		$titlepage_vn = str_replace("'", "\\'", $titlepage_vn);
		$titlepage_vn = str_replace("\\\'", "\\'", $titlepage_vn);	
	
	$copyright = (isset($_POST["copyright"]))?$_POST["copyright"]:"";
		$copyright = str_replace("'", "\\'", $copyright);
		$copyright = str_replace("\\\'", "\\'", $copyright);
	
	$copyright_vn = (isset($_POST["copyright_vn"]))?$_POST["copyright_vn"]:"";
		$copyright_vn = str_replace("'", "\\'", $copyright_vn);
		$copyright_vn = str_replace("\\\'", "\\'", $copyright_vn);
                
        $facebook = (isset($_POST["facebook"]))?$_POST["facebook"]:"";
		$facebook = str_replace("'", "\\'", $facebook);
		$facebook = str_replace("\\\'", "\\'", $facebook);
        
        $twitter = (isset($_POST["twitter"]))?$_POST["twitter"]:"";
		$twitter = str_replace("'", "\\'", $twitter);
		$twitter = str_replace("\\\'", "\\'", $twitter);
		
	
	$googlecode = (isset($_POST["googlecode"]))?$_POST["googlecode"]:"";
		$googlecode = str_replace("'", "\\'", $googlecode);
		$googlecode = str_replace("\\\'", "\\'", $googlecode);	
			
	$meta_key = (isset($_POST["meta_key"]))?$_POST["meta_key"]:"";	
		$meta_key = str_replace("'", "\\'", $meta_key);
		$meta_key = str_replace("\\\'", "\\'", $meta_key);
	$meta_des = (isset($_POST["meta_des"]))?$_POST["meta_des"]:"";	
		$meta_des = str_replace("'", "\\'", $meta_des);
		$meta_des = str_replace("\\\'", "\\'", $meta_des);	
		
		
	if ($_POST["form_"]=="edit")
	{				
		//cap nhat du lieu
		$query="update $table set titlepage = '$titlepage', titlepage_vn = '$titlepage_vn', copyright = '$copyright', copyright_vn = '$copyright_vn', googlecode = '$googlecode', meta_des = '$meta_des', meta_key = '$meta_key', facebook = '$facebook', twitter = '$twitter'";
		$query.=" where id='$id'";
		$sql = $db->update($query);								
		$db->close();							
		echo "<script>location='?mod=".$mod."&act=edit&id=$id'</script>";			
	}
?>
